<link rel="stylesheet" href="images/style.css" type="text/css" media="all" />
<?php
if(file_exists('code.pfx.lock')){
	reload_js('请先重命名code.pfx.lock后，再继续操作','index.php');
    exit();
}

$state = true;

$hostinfo[] = array('name'=>'操作系统','old'=>'不限制','new'=>PHP_OS,'state'=>true);
$hostinfo[] = array('name'=>'PHP 版本','old'=>'5.0','new'=>PHP_VERSION,'state'=>(
strpos(PHP_VERSION,'5.') === false) ? false : true);

$uploadsize = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknow';
$hostinfo[] = array('name'=>'附件上传','old'=>' 2M','new'=>$uploadsize,'state'=>(bool)(intval($uploadsize) >= 2));

$tmp = function_exists('gd_info') ? gd_info() : array();
$gd = empty($tmp['GD Version']) ? 'noext' : $tmp['GD Version'];
$hostinfo[] = array('name'=>'GD 库版本','old'=>'2.0','new'=>'2.0','state'=>true);

$space = function_exists('disk_free_space') ?  '> 50M' : 'unknow';
$hostinfo[] = array('name'=>'磁盘空间','old'=>'50M','new'=>$space,'state'=>true);

$hostinfo[] = array('name'=>'MySQL','old'=>'5.0','new'=>mysql_get_client_info(),'state'=>true);

$pdo = class_exists('PDO') ? 'PDO' : 'unknow';
$hostinfo[] = array('name'=>'PDO','old'=>'PDO','new'=>$pdo,'state'=>true);
$pdo_mysql = class_exists('PDO') ? PDO::getAvailableDrivers() : array('unknow');
$hostinfo[] = array('name'=>'PDO Mysql','old'=>'PDO Mysql','new'=>'PDO('.implode(',',$pdo_mysql).')','state'=>true);

$function = function_check();

function function_check() 
{
	$func_items = array('mysql_connect');
	foreach($func_items as $item) {
		$function[] = array($item.'()',function_exists($item),'http://help.phpdiy.com/php/php/html/res/function.'.str_replace('_','-',$item).'.html');
	}
	return $function;
}
?>
<div class="container">
	<div class="header">
		<h1>duoduo淘客 安装向导</h1>
		<span>官方 <a href="http://www.fengsh8.com" target="_blank">http://www.fengsh8.com</a></span>
		<span style="margin-right:40px"> 简体中文 UTF8 版 20101022</span>	
		
		<div class="setup step1">
		<h2>开始安装</h2>
		<p>环境以及文件目录权限检查</p>
	</div>
	<div class="stepstat">
		<ul>
			<li class="current">1</li>
			<li class="unactivated">2</li>
			<li class="unactivated">3</li>
			<li class="unactivated last">4</li>
		</ul>
		<div class="stepstatbg stepstat1"></div>
	</div>
</div>
<div class="main">
<h2 class="title">环境检查</h2>
<table class="tb" style="margin:20px 0 20px 55px;">
<tr>
	<th width="150px">环境项目</th>
	<th class="padleft" width="150px">最低配置</th>
	<th class="padleft" width="280px">当前服务器</th>
</tr>
<?php foreach($hostinfo as $value):?>
<tr>
<td><?php echo $value['name'];?></td>
<td class="padleft"><?php echo $value['old'];?></td>
<td class="<?php echo $value['state'] ? 'w' : 'nw';?> pdleft1"><?php echo $value['new'];?></td>
</tr>
<?php if(!$value['state']){$state = false;}?>
<?php endforeach;?>
</table>
<h2 class="title">&nbsp;</h2>
<h2 class="title">函数依赖性检查 （如果没开启，请让空间服务商开启即可）</h2>
<table class="tb" style="margin:20px 0 20px 55px;">
<tr>
	<th width="150px" >函数名称</th>
	<th  width="150px" class="padleft">&nbsp;</th>
	<th width="280px" class="padleft">检查结果</th>
</tr>
<?php foreach($function as $value):?>
<tr>
<td><?php echo $value['0'];?></td>
<td class="padleft">&nbsp;</td>
<td class="<?php echo $value['1'] ? 'w' : 'nw';?> pdleft1"><?php echo $value['1'] ? '支持' : '不支持';?></td>
</tr>
<?php if(!$value['1']){$state = false;}?>
<?php endforeach;?>
</table>


<h2 class="title">&nbsp;</h2>
<form action="install.php" method="get">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="restall" value="<?php echo $_GET['restall']?>" />
<div class="btnbox marginbot">
<input type="button" onclick="history.back();" value="上一步">
<?php if($state==true){?>
<input type="submit" value="下一步">
<?php }else{?>
<input type="submit" value="下一步" disabled="disabled" id="next">
<?php }?>
</div>
</form>
	<div class="footer">风尚淘宝客 <a href="http://www.fengsh8.com/help" target="_blank">帮助中心</a></div>
    <div class="footer">&copy;2008 - 2009 <a href="http://www.fengsh8.com/">www.fengsh8.com</a></div>
  </div>
</div>